package org.example.hanying.entity;

import java.util.ArrayList;
import java.util.List;

public class YiXiang {

    private String yuti;

    public String getLiangci() {
        return liangci;
    }

    public void setLiangci(String liangci) {
        this.liangci = liangci;
    }

    private String liangci;



    public String getYuti() {
        return yuti;
    }

    public void setYuti(String yuti) {
        this.yuti = yuti;
    }

    private String zh_shiyi;

    private String en_shiyi;

    private String erhua;

    private List<Shili> shilis = new ArrayList<Shili>();


    public String getZh_shiyi() {
        return zh_shiyi;
    }

    public void setZh_shiyi(String zh_shiyi) {
        this.zh_shiyi = zh_shiyi;
    }

    public String getEn_shiyi() {
        return en_shiyi;
    }

    public void setEn_shiyi(String en_shiyi) {
        this.en_shiyi = en_shiyi;
    }

    public String getErhua() {
        return erhua;
    }

    public void setErhua(String erhua) {
        this.erhua = erhua;
    }

    public List<Shili> getShilis() {
        return shilis;
    }

    public void setShilis(List<Shili> shilis) {
        this.shilis = shilis;
    }

    public String toString(){
        StringBuilder sb = new StringBuilder();
        sb.append("<义项>");


        if(erhua != null && !"".equals(erhua)){
            sb.append("<儿化>").append(erhua).append("</儿化>");
        }

        if(yuti != null && !"".equals(yuti)){
            sb.append("<语体>").append(yuti).append("</语体>");
        }
        if(liangci != null && !"".equals(liangci)){
            sb.append("<量词>").append(liangci).append("</量词>");
        }
        if(zh_shiyi != null){
            zh_shiyi = zh_shiyi.replace("#释中#,#","").replace("#","").trim();
            if(!"".equals(zh_shiyi)){
                sb.append("<释义中文>").append(zh_shiyi).append("</释义中文>");
            }
        }

        if(en_shiyi != null){
            en_shiyi = en_shiyi.replace("#释英#,#","").replace("#","").trim();
            if(!"".equals(en_shiyi)) {
                sb.append("<释义英文>").append(en_shiyi).append("</释义英文>");
            }
        }

        for(int i=0; i<shilis.size(); i++){
            sb.append(shilis.get(i).toString());
        }
        sb.append("</义项>");
        return sb.toString();
    }
}
